/*
 * Copyright (c), 
 * All rights reserved.
 *
 * Change Logs:
 * Date         Author      Action
 * 2019/05/xx   zck         Create this file
 */


/**
 * @file 	drv_lcd.h
 * @brief 	LCD屏驱动
 * @details 
 * 
 */

#ifndef __DRV_LCD_H__
#define __DRV_LCD_H__

#include "stm32f4xx.h"

#define TFTLCD_DIR	0	// 0竖屏   1横屏 

// LCD数据类型
typedef struct
{
	u16 LCD_CMD;
	u16 LCD_DATA;
}TFTLCD_TypeDef;
		    
#define TFTLCD_BASE        ((u32)(0x6C000000 | 0x0000007E))
#define TFTLCD             ((TFTLCD_TypeDef *) TFTLCD_BASE)



// LCD相关参数
typedef struct  
{										    
	u16 width;			// LCD宽度
	u16 height;			// LCD高度
	u16 id;				// LCD ID
	u8  dir;            // LCD显示方向
}_tftlcd_data;


extern _tftlcd_data tftlcd_data;
extern u16  FRONT_COLOR;
extern u16  BACK_COLOR;

#define WHITE         	 0xFFFF
#define BLACK         	 0x0000	  
#define BLUE         	 0x001F  
#define BRED             0XF81F
#define GRED 			 0XFFE0
#define GBLUE			 0X07FF
#define RED           	 0xF800
#define MAGENTA       	 0xF81F
#define GREEN         	 0x07E0
#define CYAN          	 0x7FFF
#define YELLOW        	 0xFFE0
#define BROWN 			 0XBC40
#define BRRED 			 0XFC07
#define GRAY  			 0X8430

//<.h>中只能声明, 不能定义
//需要在<.c>中定义, 在<.h>中声明

//void LCD_WriteCmd(u16 cmd);
//void LCD_WriteData(u16 data);
void LCD_WriteCmdData(u16 cmd,u16 data);
void LCD_WriteData_Color(u16 color);

void LCD_Init(void);
void LCD_Set_Window(u16 sx,u16 sy,u16 width,u16 height);
void LCD_Clear(u16 Color);
void LCD_Fill(u16 xState,u16 yState,u16 xEnd,u16 yEnd,u16 color);
void LCD_DrawPoint(u16 x,u16 y);//»­µã
void LCD_DrawFRONT_COLOR(u16 x,u16 y,u16 color);
u16 LCD_ReadPoint(u16 x,u16 y);
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
void LCD_DrawLine_Color(u16 x1, u16 y1, u16 x2, u16 y2,u16 color);
void LCD_DrowSign(uint16_t x, uint16_t y, uint16_t color);
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);
void LCD_Draw_Circle(u16 x0,u16 y0,u8 r);
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode);
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len,u8 size);
void LCD_ShowxNum(u16 x,u16 y,u32 num,u8 len,u8 size,u8 mode);
void LCD_ShowString(u16 x,u16 y,u16 width,u16 height,u8 size,u8 *p);
void LCD_ShowFontHZ(u16 x, u16 y, u8 *cn);
void ShowChinese(u16 x, u16 y, u8 *cn);
void LCD_ShowPicture(u16 x, u16 y, u16 wide, u16 high,u8 *pic);
void LCD_Display_Dir(u8 dir);
void serach_ch(void);
#endif // __DRV_LCD_H__

